package org.dialMsg.Server.ServerImp;

import org.dialMsg.Mapper.TDialResultMapper;
import org.dialMsg.Pojo.TDialResult;
import org.dialMsg.Server.ServerInt.TDialResultInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;

/**
 * @author DPF
 */
@Service
public class TDialResultImp implements TDialResultInter {
    @Autowired
    private TDialResultMapper tDialResultMapper;

    @Override
    public int setTDialResult(TDialResult tDialResult) {
        // 先检查 tDialResult 是否为 null
        if (tDialResult == null) {
            return 0;
        }
        // 插入数据并返回结果
        return tDialResultMapper.insert(tDialResult);
    }


    @Override
    public List<TDialResult> queryIdByPhone(String phone) {
        List<TDialResult> tDialResults = tDialResultMapper.queryIdByPhone(phone);
        return tDialResults == null ? Collections.emptyList() : tDialResults;
    }
    public List<TDialResult> queryIdByPhoneAfter(Long lastMaxId, String phone) {
        return tDialResultMapper.queryIdByPhoneAfter(lastMaxId, phone);
    }

    @Override
    public int updateHumanStatus(Long lastMaxId,TDialResult tDialResult) {
        return tDialResultMapper.updateHumanStatus(lastMaxId, tDialResult);
    }

    @Override
    public List<TDialResult> queryIdByPhoneAfter1(Long lastMaxId, String phone, int batchSize) {
        return tDialResultMapper.queryIdByPhoneAfter1(lastMaxId, phone, batchSize);
    }

    @Override
    public Integer queryCurrentMaxId() {
        return tDialResultMapper.queryCurrentMaxId();
    }

}